/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entities;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Embeddable;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 *
 * @author Andrés Felipe
 */
@Embeddable
public class CustomerPK implements Serializable {
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 20)
    @Column(name = "identification")
    private String identification;
    @Basic(optional = false)
    @NotNull
    @Column(name = "pymeidentification")
    private int pymeidentification;

    public CustomerPK() {
    }

    public CustomerPK(String identification, int pymeidentification) {
        this.identification = identification;
        this.pymeidentification = pymeidentification;
    }

    public String getIdentification() {
        return identification;
    }

    public void setIdentification(String identification) {
        this.identification = identification;
    }

    public int getPymeidentification() {
        return pymeidentification;
    }

    public void setPymeidentification(int pymeidentification) {
        this.pymeidentification = pymeidentification;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (identification != null ? identification.hashCode() : 0);
        hash += (int) pymeidentification;
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof CustomerPK)) {
            return false;
        }
        CustomerPK other = (CustomerPK) object;
        if ((this.identification == null && other.identification != null) || (this.identification != null && !this.identification.equals(other.identification))) {
            return false;
        }
        if (this.pymeidentification != other.pymeidentification) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entities.CustomerPK[ identification=" + identification + ", pymeidentification=" + pymeidentification + " ]";
    }
    
}
